package com.wtwd.device.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wtwd.device.model.entity.Device;
import com.wtwd.device.model.entity.ExportDevice;
import com.wtwd.device.model.vo.CountAreaDeviceVO;
import com.wtwd.device.model.vo.WatchVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * @author ljiong
 * @date 2021/08/06
 * @description
 */
@Mapper
public interface DeviceInfoMapper extends BaseMapper<Device> {

    IPage<WatchVo> getWatchListByConditions(@Param("searchMap") HashMap<String, Object> searchMap, @Param("page") Page<Object> page);

    Integer bathDelDeviceByDeviceIdList(@Param("list") List<Integer> deviceIdList);

    Integer deleteDeviceByDeviceId(@Param("deviceId") Integer deviceId);

    Integer batchSaveDevice(@Param("list") List<Device> deviceInfos);

    ArrayList<String> getWatchByGroupWatchId(@Param("list") List<String> watchIdList);

    Device getWatchByMacAddress(@Param("macAddress") String macAddress);

    List<String> getWatchIdByGroupByCustomerId(@Param("customerId") Long customerId);

    Integer activeDevice(@Param("macAddress") String macAddress, @Param("watchId") String watchId,@Param("currentFirmware") String currentFirmware,@Param("activation") Integer activation);

    List<CountAreaDeviceVO> countAreaDeviceByCustomerId(@Param("customerId") Long customerId,@Param("activation") Integer activation);

    List<ExportDevice> exportDeviceInfo(@Param("macAddress") String macAddress,@Param("activation") Integer activation,@Param("customerName") String customerName,@Param("customerId") Long customerId);

    Integer unbindDevice(@Param("macAddress") String macAddress);

    IPage<Device> getWatchListByConditionsPage(@Param("macAddress") String macAddress, @Param("activation") Integer activation,@Param("customerId")  Long customerId,@Param("list")  List<Long> customerIds, Page<Device> page);
}
